package org.jivesoftware.smack.filter;

import org.jivesoftware.smack.packet.Packet;

public class OrFilter
  implements PacketFilter
{
  private int size;
  private PacketFilter[] filters;

  public OrFilter()
  {
    this.size = 0;
    this.filters = new PacketFilter[3];
  }

  public OrFilter(PacketFilter paramPacketFilter1, PacketFilter paramPacketFilter2)
  {
    if ((paramPacketFilter1 == null) || (paramPacketFilter2 == null))
      throw new IllegalArgumentException("Parameters cannot be null.");
    this.size = 2;
    this.filters = new PacketFilter[2];
    this.filters[0] = paramPacketFilter1;
    this.filters[1] = paramPacketFilter2;
  }

  public void addFilter(PacketFilter paramPacketFilter)
  {
    if (paramPacketFilter == null)
      throw new IllegalArgumentException("Parameter cannot be null.");
    if (this.size == this.filters.length)
    {
      PacketFilter[] arrayOfPacketFilter = new PacketFilter[this.filters.length + 2];
      for (int i = 0; i < this.filters.length; i++)
        arrayOfPacketFilter[i] = this.filters[i];
      this.filters = arrayOfPacketFilter;
    }
    this.filters[this.size] = paramPacketFilter;
    this.size += 1;
  }

  public boolean accept(Packet paramPacket)
  {
    for (int i = 0; i < this.size; i++)
      if (this.filters[i].accept(paramPacket))
        return true;
    return false;
  }

  public String toString()
  {
    return this.filters.toString();
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     org.jivesoftware.smack.filter.OrFilter
 * JD-Core Version:    0.6.1
 */